package com.gc.cn.p2_kewai;

public class DemoTest {
    public static void main(String[] args) {
        int[] arrA = {5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20};

        for (int i = 0; i < arrA.length; i++) {
            if (arrA[i] % 2 == 1) {
                System.out.print(arrA[i] + " ");
                
            }
        }
        for (int i = 0; i < arrA.length; i++) {
            if (arrA[i] % 2 == 0) {
                System.out.print(arrA[i] + " ");
            }
        }/*
        int oddCount = 0;
        int evenCount = 0;
        for (int num : arrA) {
            if (num % 2 == 1) {
                oddCount++;
            } else {
                evenCount++;
            }
        }
        int[] newArr = new int[arrA.length];
        int oddIndex = 0;
        int evenIndex = oddCount;
        for (int num : arrA) {
            if (num % 2 == 1) {
                newArr[oddIndex++] = num;
            } else {
                newArr[evenIndex++] = num;
            }
        }
        for (int num : newArr) {
            System.out.print(num + " ");
        }
    }*/
    }
}